'use strict';
//项目主入口模块
angular.module('appModule', [
	'ui.router',
	'listModule.controller',
	'detailModule.controller',
	'listModule.service',
	'configModule',
	'crossModule.service'
])
	.config(['$stateProvider','$urlRouterProvider', function ($stateProvider,$urlRouterProvider) {
		$stateProvider
			.state('list',{
				url: "/list/:type",
				templateUrl: './areas/list/list.html',
				controller: 'listController'
			})
			.state('detail',{
				url: "/detail/:type",
				templateUrl: './areas/detail/detail.html',
				controller: 'detailController'
			})
		$urlRouterProvider.otherwise('/list/in_theaters');
	}])
	.controller('mainController',['$scope',function ($scope) {
		//控制左侧tab背景
		$scope.isActive1 = true;
		//搜索功能
		$scope.search = '';
		$scope.change = function () {};
		$scope.$on('listToApp',function (event, fn) {
			$scope.change = fn;
			// console.log($scope.change);
		});
		$scope.$watch('search',function () {
			if( $scope.search ){
				$scope.change( $scope.search );
			}
		})



	}])



